<!doctype html>
<!--
Tests that when a screen taps causes a frame that isn't presenting to gain
focus, that the presenting frame still receives input.
-->
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="../resources/webxr_e2e.css">
  </head>
  <body>
    <canvas id="webgl-canvas"></canvas>
    <script src="../../../../../../third_party/blink/web_tests/resources/testharness.js"></script>
    <script src="../resources/webxr_e2e.js"></script>
    <script src="../resources/webxr_boilerplate.js"></script>
    <script>
      setup({single_test: true});

      var rafCount = 0;

      function stepSetupFocusLoss() {
        onImmersiveXRFrameCallback = null;
        setTimeout(function() {
          document.getElementById('externalframe').contentWindow.focus();
        }, 1000);
      }

      window.onblur = function() {
        onImmersiveXRFrameCallback = function() {
          if (rafCount == 3) {
            done();
          }
          rafCount++;
        }
      }
    </script>
    <iframe id="externalframe" width="1" height="1" src="about:blank" />
  </body>
</html>
